{% extends 'layout.html' %}

{% load my_tags %}

{% block content %}

    <div>
        <a href="{% url 'crm:customer_add' %}" class="btn btn-primary btn-sm">新增</a>
    </div>


    <form action="" class="form-inline pull-right">
        <input type="text" name="query" class="form-control">
        <button class="btn btn-sm btn-success">搜索</button>

    </form>


    <form action="" method="post" class="form-inline">

        {% csrf_token %}

        <select name="action" id="" class="form-control">

            {% if request.path_info == url %}
                <option value="multi_apply">公户变私户</option>
            {% else %}
                <option value="multi_pub">私户变公户</option>
            {% endif %}

            {#            <option value="multi_del">批量删除</option>#}

        </select>
        <button class="btn btn-primary btn-sm">提交</button>

        <table class="table table-bordered table-hover">
            <thead>
            <tr>
                <th>选择</th>
                <th>序号</th>
                <th>qq</th>
                <th>姓名</th>
                <th>性别</th>
                <th>手机号</th>
                <th>客户来源</th>
                {#            <th>咨询课程</th>#}
                <th>状态</th>
                <th>最后跟进日期</th>
                {#            <th>再次跟进时间</th>#}
                <th>销售</th>
                <th>班级</th>
                <th>操作</th>
            </tr>
            </thead>
            <tbody>

            {% for customer in all_customers %}
                <tr>
                    <td><input type="checkbox" name="pk" value="{{ customer.pk }}"></td>
                    <td>{{ forloop.counter }}</td>
                    <td>{{ customer.qq }}</td>
                    <td>{{ customer.name|default:'-' }}</td>
                    <td>{{ customer.get_sex_display }}</td>
                    <td>{{ customer.phone|default:'-' }}</td>
                    <td>{{ customer.get_source_display }}</td>
                    {#                <td>{{ customer.course }}</td>#}
                    <td> {{ customer.show_status }} </td>
                    <td>{{ customer.last_consult_date }}</td>
                    {#                <td>{{ customer.next_date|default:'-' }}</td>#}
                    <td>{{ customer.consultant }}</td>
                    <td>{{ customer.show_class }}  </td>
                    <td>
                        <a class="btn btn-sm btn-danger" href="{% url_tag request 'crm:customer_edit' customer.pk %}">编辑</a>
                        <a class="btn btn-sm btn-success" href="{% url_tag request 'crm:one_customer_record_list' customer.pk %}">查看跟进</a>
                        <a class="btn btn-sm btn-warning" href="{% url_tag request 'crm:one_enrollment_list' customer.pk %}">查看报名表</a>
                        <a class="btn btn-sm btn-warning" href="{% url_tag request 'crm:enrollment_add' customer.pk %}">添加报名表</a>

                    </td>
                    {#                <td>#}
                    {##}
                    {#                    {% for class in  customer.class_list.all %}#}
                    {#                        {% if forloop.last %}#}
                    {#                            {{ class }}#}
                    {#                        {% else %}#}
                    {#                            {{ class }},#}
                    {#                        {% endif %}#}
                    {#                         #}
                    {#                    {% endfor %}#}
                    {##}
                    {#                </td>#}


                </tr>
            {% endfor %}

            </tbody>
        </table>
    </form>
    <nav aria-label="Page navigation">
        <ul class="pagination">

            {{ page_html }}
        </ul>
    </nav>


{% endblock %}